package org.example.project.search.ui

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

/**
 * 专题卡片
 */
@Composable
fun SpecialTopicCard(types: List<String>, modifier: Modifier = Modifier) {
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .background(
                color = Color.White,
                shape = RoundedCornerShape(bottomEnd = 16.dp, bottomStart = 16.dp)
            ) // 设置背景色和圆角形状
            .padding(start = 12.dp, top = 8.dp, end = 12.dp, bottom = 8.dp),
    ) {

        LazyRow(
            modifier = Modifier.padding(start = 10.dp)
        ) {
            items(types.size) {
                Column(
                    modifier = Modifier.padding(end = 30.dp),
                    horizontalAlignment = Alignment.CenterHorizontally
                ) {
                    Column(
                        modifier = Modifier
                            .size(width = 35.dp, height = 40.dp)
                            .padding(bottom = 5.dp)
                            .background(
                                color = Color(0xfff1f3f5),
                                shape = RoundedCornerShape(16.dp)
                            ),
                        horizontalAlignment = Alignment.CenterHorizontally,
                        verticalArrangement = Arrangement.Center
                    ) {
                        Img(16.dp)
                    }

                    Text(
                        text = types[it],
                        fontSize = 13.sp,
                        fontWeight = FontWeight.Light
                    )
                }
            }
        }
    }
}